package at.ac.tuwien.ewa.g70.validator;

import java.util.ResourceBundle;
import javax.faces.application.FacesMessage;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.validator.Validator;
import javax.faces.validator.ValidatorException;

public class StackValidator implements Validator {

    /* (non-Javadoc)
     * @see javax.faces.validator.Validator#validate(javax.faces.context.FacesContext, javax.faces.component.UIComponent, java.lang.Object)
     */
    @Override
    public void validate(FacesContext facesContext, UIComponent component, Object object)
            throws ValidatorException {

        int stack = (Integer) object;

        if( stack != 4 && stack != 16 && stack != 36) {
            throw new ValidatorException(new FacesMessage(""));
        }
    }
}